require "base_def"

local handle_config = {}

--拉取游戏配置
function handle_config.GetGameConfig()
    local str = string.format("call pr_get_cfg('%s')", "game_config")
    local ret = CallMysql(str)
    if ret and ret[1] then 
        return true, ret[1]
    else 
        log.error("GetGameConfig error!", ret)
    end

    return false
end

--拉取游戏房间配置
function handle_config.GetGameRoomConfig()
    local str = string.format("call pr_get_cfg('%s')", "gameroom_config")
    local ret = CallMysql(str)
    if ret and ret[1] then 
        return true, ret[1]
    else 
        log.error("GetGameRoomConfig error!", ret)
    end

    return false
end

--拉取成就配置
function handle_config.GetAchieveConfig()
    local str = string.format("call pr_get_cfg('%s')", "achieve_config")
    local ret = CallMysql(str)
    if ret and ret[1] then 
        return true, ret[1]
    else 
        log.error("GetAchieveConfig error!", ret)
    end

    return false
end

--拉取vip配置
function handle_config.GetVipConfig()
    local str = string.format("call pr_get_cfg('%s')", "vip_config")
    local ret = CallMysql(str)
    if ret and ret[1] then 
        return true, ret[1]
    else 
        log.error("GetVipConfig error!", ret)
    end

    return false
end

--拉取牌型配置
function handle_config.GetCardConfig()
    local str = string.format("call pr_get_cfg('%s')", "card_config")
    local ret = CallMysql(str)
    if ret and ret[1] then 
        return true, ret[1]
    else 
        log.error("GetCardConfig error!", ret)
    end

    return false
end

return handle_config